package com.chinasofti;

import java.util.ArrayList;

public class StudentTest {
    /**
     *  需求：创建一个存储学生对象的集合，存储三个学生（name, age）,使用程序实现控制台遍历该集合
     */
    public static void main(String[] args) {
        ArrayList<Student> arrayList = new ArrayList<>();

        Student s1 = new Student("风清扬",80);
        Student s2 = new Student("令狐冲",31);
        Student s3 = new Student("岳灵珊",28);

        arrayList.add(s1);
        arrayList.add(s2);
        arrayList.add(s3);

        for (int i=0;i<arrayList.size();i++){
            Student s = arrayList.get(i);
            System.out.println(s.getAge()+"  = " + s.getName());
        }

    }
    }

